﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
using System.Threading;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            AutoResetEvent are = new AutoResetEvent(false);

            are.Set();
            are.Set();
            Console.WriteLine("1");
            are.WaitOne();
            are.Set();
            are.Set();
            Console.WriteLine("2");
            are.WaitOne();
            Console.WriteLine("3");
            are.WaitOne();
            Console.WriteLine("4");
        }
    }
}
